<?php
namespace App\Service\PssService;

use App\Service\BaseService;
use App\Service\Code\Normal;
use App\Model\PssModel\MerchantUserRootConfig;

/**
 * 三方平台授权查询服务
 *
 * @author chenyun
 */
class TripartitePlatformService extends BaseService
{

    const CACHE_KEY = 'tripartiteplatform_query_';

    /**
     * 三方授权平台批量查询服务
     *
     * @param array $param            
     * @return mixed
     */
    public function QueryTripartitePlatformList(array $param = [])
    {
        $where = [];
        if(isset($param["PlatformName"]) && $param["PlatformName"]){
            $PlatformName = $param['PlatformName'];
            $where[]=["user_tag_name","=","{$PlatformName}"];
        }
        if(isset($param["ID"]) && !empty($param["ID"])){
            $ID = $param['ID'];
            $restlt = MerchantUserRootConfig::where('id', $param["ID"])->first();
            return Normal::returnCode(Normal::SUC,"获取成功",$restlt);
        }
        $resultTripartitePlatformList = MerchantUserRootConfig::instance()->where($where)->orderBy("id","desc")->get()->toArray();
        return Normal::returnCode(Normal::SUC,"获取成功",$resultTripartitePlatformList);
    }
}